package com.lanyou.esb.datadictionary;

import java.rmi.NoSuchObjectException;

import org.apache.commons.lang3.StringUtils;

/**
 * 平台吞吐量时间周期 <br>
 * 描述：<br>
 * 1:昨天; 2:今天; 3:一周内; 4:一月内; 5:一年内;
 * 
 * @author Davey.wu
 */
public enum PeriodType {
	//
	YESTODAY("1"), TODAY("2"), WEEK("3"), MONTH("4"), YEAR("5");

	public static final String TypeCode = "20018";

	public final String ValueCode;

	private PeriodType(String code) {
		this.ValueCode = code;
	}

	public static PeriodType get(String valueCode) throws NoSuchObjectException {
		if (StringUtils.isEmpty(valueCode)) {
			throw new NullPointerException();
		}
		for (PeriodType type : PeriodType.values()) {
			if (type.ValueCode.equals(valueCode)) {
				return type;
			}
		}
		throw new NoSuchObjectException(valueCode);
	}
}
